package org.getOffer.offer50;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author yu
 * @Date 2021/9/27
 */
public class Solution {

    public static void main(String[] args) {

        String s = "abaccdeeff";

        //String s = "lleetcode";

        System.out.println(firstUniqChar(s));

    }

    public static char firstUniqChar(String s) {

        if (s.length() == 0) {
            return ' ';
        }

        char[] chars = s.toCharArray();

        int[] arrays = new int[26];

        for (char c : chars) {
            arrays[c - 'a']++;
        }

        for (char c : chars) {
            if (arrays[c - 'a'] == 1) {
                return c;
            }
        }

        return ' ';

    }

}
